﻿using Api.Entitys;
using Core.Authorization;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Api
{
    public class AuthorizedUsers : Authorized<UserInfo>
    {
        private readonly CommonProcess Process;

        public AuthorizedUsers()
        {
            Process = new CommonProcess();
        }

        protected override int[] GetCommands(int RoleId)
        {
            return null;
        }

        protected override int[] GetRoles(int UserId)
        {
            try
            {
                Process.Params.Add("InternalUserId", UserId);

                return Process.ProcessCommand<int[]>(Process.GetCommand("ReadUserRoles"));
            }
            finally
            {
                Process.Params.RemoveLast("InternalUserId");
            }
        }
    }
}